package com.haoshuang.zhouzhoubang.ui.page.settled.background

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.SettledInfoBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData


class BackgroundInputInfoViewModel : BaseViewModel() {

    /**
     *
     */
    val getStoreSettledInfoData = StatefulMutableLiveData<ResponseBean<SettledInfoBean>>()
    fun getStoreSettledInfo() = netRequest {
        start { getStoreSettledInfoData.value = StateData.Loading }
        request { ApiRepo.getStoreSettledInfo() }
        success { getStoreSettledInfoData.value = StateData.Success(it) }
        error { code, msg ->
            getStoreSettledInfoData.value = StateData.Error(code, msg)
        }
    }

}